using Microsoft.EntityFrameworkCore;
using MyApi.Api.Entity;

namespace MyApi.Api.Db
{
    public class MyApiDb : DbContext
    {
     // 因为我们使用AddDbContext到容器，所以此处必须得有带参数的构造函数（而且必须传递DbContextOptions类型的参数，同时父类也得调用这个参数）
        public MyApiDb(DbContextOptions options):base(options)
        {

        }
        public DbSet<Users> Users { get; set; }
        public DbSet<Roles> Roles { get; set; }
        public DbSet<UserRoles> UserRoles { get; set; }
        public DbSet<AuditInfo>  AuditInfo  {get;set;}


        protected override void OnConfiguring(
            DbContextOptionsBuilder options
        ) =>
            options
                .UseSqlServer(@"server=.;uid=sa;pwd=123456;database=Admin100");
    }
}
